#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#define N 1000
bool isPrime[N];
int prime[N];
typedef struct mypair{
    int num;
    int count;
}mypair;
#define SIZE 128
mypair pair[SIZE];
void euler()
{
    printf("euler begin\n");
    int cnt = 0;
    //isPrime[1] = true;
    for(int i = 2;i<=N;++i)
    {
        if(!isPrime[i])
        {
            prime[cnt++] = i;
        }
        for(int j = 0;prime[j]*i<=N;++j)
        {
            isPrime[i*prime[j]] = true;
            if(i%prime[j]==0)
            {
                break;
            }
        }
    }
    printf("euler end\n");
}
int main()
{
    int n = 0;
    printf("input:");
    scanf("%d",&n);
    euler();
    ////////////////////////////////
    int cur = 0;
    int copy = n;
    int cnt = 0;
    printf("begin\n");
    while(n>1)
    {
        int count = 0;
        while(n%prime[cur] == 0)
        {
            printf("prime:%d,%d\n",prime[cur],n);
            sleep(1);
            printf("%d\n",n);
            n = n/prime[cur];
            count+=1;
        }
        if(count!=0)
        {
            pair[cnt].num = prime[cur];
            pair[cnt++].count = count;
        }
        cur+=1;
    }
    printf("end\n");
    printf("%d^%d ",pair[0].num,pair[0].count);
    for(int i = 1;i<cnt;++i)
    {
        printf("x %d^%d ",pair[i].num,pair[i].count);
    }
    
    return 0;
}
